<!DOCTYPE html>


<html lang="zh-Hans">
  

    <head>
      <meta charset="utf-8" />
       
      <meta name="keywords" content="博客，代码，思考，生活" />
       
      <meta name="description" content="笔记汇总" />
      
      <meta
        name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1"
      />
      <title>Math |  Zhang Shuo&#39;s Studio</title>
  <meta name="generator" content="hexo-theme-ayer">
      
      <link rel="shortcut icon" href="/hexo1/favicon.ico" />
       
<link rel="stylesheet" href="/hexo1/dist/main.css">

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css"
      />
      
<link rel="stylesheet" href="/hexo1/css/custom.css">
 
      <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
       
 

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
      />
      <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>

      <!-- mermaid -->
      
      <style>
        .swal2-styled.swal2-confirm {
          font-size: 1.6rem;
        }
      </style>
    <link rel="alternate" href="/hexo1/atom.xml" title="Zhang Shuo's Studio" type="application/atom+xml">
</head>
  </html>
</html>


<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-java基础/Math"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  Math
</h1>
 

      
    </header>
     
    <div class="article-meta">
      <a href="/hexo1/2019/08/13/java%E5%9F%BA%E7%A1%80/Math/" class="article-date">
  <time datetime="2019-08-13T09:00:00.000Z" itemprop="datePublished">2019-08-13</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/hexo1/categories/java%E5%9F%BA%E7%A1%80/">java基础</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> Word count:</span>
            <span class="post-count">1.5k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> Reading time≈</span>
            <span class="post-count">6 min</span>
        </span>
    </span>
</div>
 
    </div>
      



  
    <div class="article-entry" itemprop="articleBody">
       
  <p>Math 类封装了常用的数学运算，提供了基本的数学操作，如指数、对数、平方根和三角函数等。Math 类位于 java.lang 包，它的<strong>构造方法是 private</strong> 的，因此<strong>无法创建 Math 类的对象</strong>，并且 Math 类中的所有方法都是类方法，可以直接通过类名来调用它们。</p>
<p>下面详细介绍该类的常量及数学处理方法。</p>
<p><strong>静态常量</strong></p>
<p>Math 类中包含 E 和 PI 两个静态常量，正如它们名字所暗示的，它们的值分别等于 e（自然对数）和 π（圆周率）。</p>
<p>System.out.println(&quot;E 常量的值：&quot; + Math.E); System.out.println(&quot;PI 常量的值：&quot; + Math.PI);</p>
<p>E 常量的值：2.718281828459045 PI 常量的值：3.141592653589793</p>
<p><strong>求最大值、最小值和绝对值</strong></p>
<p>在程序中常见的就是求最大值、最小值和绝对值问题，如果使用 Math 类提供的方法可以很容易实现。这些方法的说明如表 1 所示。</p>
<hr>
<p>  方法                                   说明</p>
<p>  static int abs(int a)                  返回 a 的绝对值</p>
<p>  static long abs(long a)                返回 a 的绝对值</p>
<p>  static float abs(float a)              返回 a 的绝对值</p>
<p>  static double abs(double a)            返回 a 的绝对值</p>
<p>  static int max(int x,int y)            返回 x 和 y 中的最大值</p>
<p>  static double max(double x,double y)   返回 x 和 y 中的最大值</p>
<p>  static long max(long x,long y)         返回 x 和 y 中的最大值</p>
<p>  static float max(float x,float y)      返回 x 和 y 中的最大值</p>
<p>  static int min(int x,int y)            返回 x 和 y 中的最小值</p>
<p>  static long min(long x,long y)         返回 x 和 y 中的最小值</p>
<p>  static double min(double x,double y)   返回 x 和 y 中的最小值</p>
<p>  static float min(float x,float y)      返回 x 和 y 中的最小值</p>
<hr>
<p>public class Test02 { public static void main(String[] args) { System.out.println(&quot;10 和 20 的较大值：&quot; + Math.max(10, 20)); System.out.println(&quot;15.6 和 15 的较小值：&quot; + Math.min(15.6, 15)); System.out.println(&quot;-12 的绝对值：&quot; + Math.abs(-12)); } }</p>
<p><strong>求整运算</strong></p>
<hr>
<p>  方法                            说明</p>
<p>  static double ceil(double a)    返回大于或等于 a 的最小整数</p>
<p>  static double floor(double a)   返回小于或等于 a 的最大整数</p>
<p>  static double rint(double a)    返回最接近 a 的整数值，如果有两个同样接近的整数，则结果取偶数</p>
<p>  static int round(float a)       将参数加上 1/2 后返回与参数最近的整数</p>
<p>  static long round(double a)     将参数加上 1/2 后返回与参数最近的整数，然后强制转换为长整型</p>
<hr>
<p>import java.util.Scanner; public class Test03 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.outprintln(&quot;请输入一个数字：&quot;); double num = input.nextDouble(); System.out.println(&quot;大于或等于 &quot;+ num +&quot; 的最小整数：&quot; + Math.ceil(num)); System.out.println(&quot;小于或等于 &quot;+ num +&quot; 的最大整数：&quot; + Math.floor(num)); System.out.println(&quot;将 &quot;+ num +&quot; 加上 0.5 之后最接近的整数：&quot; + Math.round(num)); System.out.println(&quot;最接近 &quot;+num+&quot; 的整数：&quot; + Math.rint(num)); } } 执行结果如下： 请输入一个数字： 99.01 大于或等于 99.01 的最小整数：100.0 小于或等于 99.01 的最大整数：99.0 将 99.01 加上 0.5 之后最接近的整数：100 最接近 99.01 的整数：99.0</p>
<p><strong>三角函数运算</strong></p>
<hr>
<p>  方法                                     说明</p>
<p>  static double sin(double a)              返回角的三角正弦值，参数以孤度为单位</p>
<p>  static double cos(double a)              返回角的三角余弦值，参数以孤度为单位</p>
<p>  static double asin(double a)             返回一个值的反正弦值，参数域在 [-1,1]，值域在 [-PI/2,PI/2]</p>
<p>  static double acos(double a)             返回一个值的反余弦值，参数域在 [-1,1]，值域在 [0.0,PI]</p>
<p>  static double tan(double a)              返回角的三角正切值，参数以弧度为单位</p>
<p>  static double atan(double a)             返回一个值的反正切值，值域在 [-PI/2,PI/2]</p>
<p>  static double toDegrees(double angrad)   将用孤度表示的角转换为近似相等的用角度表示的角</p>
<p>  staticdouble toRadians(double angdeg)    将用角度表示的角转换为近似相等的用弧度表示的角</p>
<hr>
<p>在表 3 中，每个方法的参数和返回值都是 double 类型，参数以弧度代替角度来实现，其中 1 度等于 π/180 弧度，因此平角就是 π 弧度。</p>
<p>计算 90 度的正弦值、0 度的余弦值、1 的反正切值、120 度的弧度值 public class Test04 { public static void main(String[] args) { System.out.println{&quot;90 度的正弦值：&quot; + Math.sin(Math.PI/2)); System.out.println(&quot;0 度的余弦值：&quot; + Math.cos(0)); System.out.println(&quot;1 的反正切值：&quot; + Math.atan(l)); System.out.println(&quot;120 度的弧度值：&quot; + Math.toRadians(120.0)); } } 90 度的正弦值：1.0 0 的余弦值：1.0 1 的反正切值：0.7853981633974483 120 度的弧度值：2.0943951023931953</p>
<p>在上述代码中，因为 Math.sin() 中的参数的单位是弧度，而 90 度表示的是角度，因此需要将 90 度转换为弧度，即 Math.PI/180*90，故转换后的弧度为 Math.PI/2，然后调用 Math 类中的 sin() 方法计算其正弦值。</p>
<p><strong>指数运算</strong></p>
<p>指数的运算包括求方根、取对数及其求 n 次方的运算。</p>
<hr>
<p>  方法                                   说明</p>
<p>  static double exp(double a)            返回 e 的 a 次幂</p>
<p>  static double pow(double a,double b)   返回以 a 为底数，以 b 为指数的幂值</p>
<p>  static double sqrt(double a)           返回 a 的平方根</p>
<p>  static double cbrt(double a)           返回 a 的立方根</p>
<p>  static double log(double a)            返回 a 的自然对数，即 lna 的值</p>
<p>  static double log10(double a)          返回以 10 为底 a 的对数</p>
<hr>
<p>例 5</p>
<p>使用 Math 类中的方法实现指数的运算，main() 方法中的代码如下：</p>
<p>public class Test05 { public static void main(String[] args) { System.out.println(&quot;4 的立方值：&quot; + Math.pow(4, 3)); System.out.println(&quot;16 的平方根：&quot; + Math.sqrt(16)); System.out.println(&quot;10 为底 2 的对数：&quot; + Math.log1O(2)); } } 4 的立方值：64.0 16 的平方根：4.0 10 为底 2 的对数：0.3010299956639812</p>
 
      <!-- reward -->
      
      <div id="reword-out">
        <div id="reward-btn">
          Donate
        </div>
      </div>
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>Copyright： </strong>
          
          Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://gitee.com/zhang-shuo-fr/hexo1.git/2019/08/13/java%E5%9F%BA%E7%A1%80/Math/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/hexo1/tags/Math-%E8%AF%B4%E6%98%8E%EF%BC%9A%E6%96%87%E7%AB%A0%E6%A0%87%E7%AD%BE/" rel="tag">Math#说明：文章标签</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/hexo1/2019/08/13/java%E5%9F%BA%E7%A1%80/NumberFormat/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            NumberFormat
          
        </div>
      </a>
    
    
      <a href="/hexo1/2019/08/13/java%E5%9F%BA%E7%A1%80/Optional/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">Optional</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "",
    app_key: "",
    path: window.location.pathname,
    avatar: "monsterid",
    placeholder: "给我的文章加点评论吧~",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
   
     
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2020-2021
        <i class="ri-heart-fill heart_icon"></i> Zhang Shuo
      </li>
    </ul>
    <ul>
      <li>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>Visitors:<span id="busuanzi_value_site_uv"></span></span>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>Views:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src=''></script>
        
      </li>
    </ul>
  </div>
</footer>    
    </main>
    <div class="float_btns">
      <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

    </div>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/hexo1/"><img src="/hexo1/images/ayer-side.svg" alt="Zhang Shuo&#39;s Studio"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo1/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo1/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo1/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo1/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo1/tags/%E6%97%85%E8%A1%8C/">旅行</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" target="_blank" rel="noopener" href="http://shenyu-vip.lofter.com">摄影</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo1/2019/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/hexo1/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/hexo1/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/hexo1/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/hexo1/js/jquery-3.6.0.min.js"></script>
 
<script src="/hexo1/js/lazyload.min.js"></script>

<!-- Tocbot -->
 
<script src="/hexo1/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: ".tocbot",
    contentSelector: ".article-entry",
    headingSelector: "h1, h2, h3, h4, h5, h6",
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: "main",
    positionFixedSelector: ".tocbot",
    positionFixedClass: "is-position-fixed",
    fixedSidebarOffset: "auto",
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/hexo1/dist/main.js"></script>

<!-- ImageViewer -->
 <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script> 
<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->
 
<script src="/hexo1/js/busuanzi-2.3.pure.min.js"></script>
 
<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->
 
<link rel="stylesheet" href="/hexo1/css/clipboard.css">
 <script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>
 
<!-- CanvasBackground -->

<script>
  if (window.mermaid) {
    mermaid.initialize({ theme: "forest" });
  }
</script>


    
    <div id="music">
    
    
    
    <iframe frameborder="no" border="1" marginwidth="0" marginheight="0" width="200" height="52"
        src="//music.163.com/outchain/player?type=2&id=22707008&auto=1&height=32"></iframe>
</div>

<style>
    #music {
        position: fixed;
        right: 15px;
        bottom: 0;
        z-index: 998;
    }
</style>
    
    

  </div>
</body>

</html>